package com.madi.company.ui.mainfragment;

import android.content.Intent;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TextView;

import com.jaydenxiao.common.base.BaseFragment;
import com.madi.company.R;
import com.madi.company.bean.PersonalHomePageEntity;
import com.madi.company.ui.personalCenter.adapter.PersonalHomePageAdapter;
import com.madi.company.ui.usercenter.LoginActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;


/**
 * des:个人中心
 * Created by 叮咛
 * on 2016.11.29
 */
public class PersonFragment extends BaseFragment {


    @Bind(R.id.usercenter_headImg)
    ImageView mUsercenterHeadImg;
    @Bind(R.id.usercenter_nameAndLogin)
    TextView mUsercenterNameAndLogin;
    @Bind(R.id.recycler_view_item)
    RecyclerView mRecyclerViewItem;
    @Bind(R.id.switchCN)
    RadioButton mSwitchCN;
    @Bind(R.id.switchEN)
    RadioButton mSwitchEN;
    @Bind(R.id.switchLanguage)
    RadioGroup mSwitchLanguage;
    private List<PersonalHomePageEntity> mPageBeanList = new ArrayList<>();

    @Override
    protected int getLayoutResource() {
        return R.layout.fra_person;
    }

    @Override
    public void initPresenter() {

    }

    @Override
    protected void initView() {
        initPageBeanList();
        mRecyclerViewItem.setLayoutManager(new LinearLayoutManager(getActivity()));
        PersonalHomePageAdapter personalHomePageAdapter = new PersonalHomePageAdapter(getActivity());
        personalHomePageAdapter.setData(mPageBeanList);
        mRecyclerViewItem.setAdapter(personalHomePageAdapter);
        /**
         *  需要判斷是否是登錄狀態
         */
        mUsercenterNameAndLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                startActivity(new Intent(getActivity(), LoginActivity.class));
            }
        });



    }
    private void initPageBeanList() {
        mPageBeanList.add(new PersonalHomePageEntity(R.mipmap.usercenter_download_bg,getResources().getString(R.string.my_public_online)));
        mPageBeanList.add(new PersonalHomePageEntity(R.mipmap.usercenter_remark_bg,"备注"));
        mPageBeanList.add(new PersonalHomePageEntity(R.mipmap.usercenter_infos_bg,"我的信息"));
        mPageBeanList.add(new PersonalHomePageEntity(R.mipmap.usercenter_suggest_bg,"意见反馈"));
        mPageBeanList.add(new PersonalHomePageEntity(R.mipmap.usercenter_sets_bg,"设置"));
    }
}
